/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package stuff.web;

import java.io.Serializable;
import java.util.Set;
import javax.validation.ConstraintViolation;
import stuff.Account;

/**
 *
 * @author Николай
 */
public class JSONResponse implements Serializable {
    
    private String state = "OK";
    private int errCount = 0;
    private String msg[] = null;

    public JSONResponse() {}

    public JSONResponse(Set<ConstraintViolation<Account>> errSet) {
        msg = new String[errSet.size()];
        if (errSet.size() > 0) {
            state = "ERR";
            for(ConstraintViolation<Account> err : errSet) 
                msg[errCount++] = err.getMessage();
        }
    }

    //--------------------------------
    public int getErrCount() {
        return errCount;
    }

    public void setErrCount(int errCount) {
        this.errCount = errCount;
    }

    public String[] getMsg() {
        return msg;
    }

    public void setMsg(String[] msg) {
        this.msg = msg;
    }

    public String getState() {
        return state;
    }

    public void setState(String state) {
        this.state = state;
    }
    
}
